[AS3] BitmapData cut-off

Posted by Fristi on Stack Overflow See other posts from Stack Overflow or by Fristi
Published on 2010-03-13T19:38:32Z Indexed on 2010/03/13 19:45 UTC
Read the original article Hit count: 469

Hello,

I am writing a MovieClip rasterizer which rasterizes all the frames in the specified movieclip. Here's the code for rasterizing:

for ( var i:int = start; i <= end; i++ )
{
 //goto the next frame
 clip.gotoAndStop( i );

//get the bounds bounds = clip.getBounds(clip);

//create a new bitmapdata container bitmapData = new BitmapData( transformer.width == -1 ? bounds.width : transformer.width, transformer.height == -1 ? bounds.height : transformer.height, transformer.transparent, transformer.color );

//rotate the clip if (clip.rotation != 0) transformer.rotate( clip.rotation * (Math.PI / 180) ); //scale the clip if (clip.scaleX != 1 || clip.scaleY != 1) transformer.scale( clip.scaleX, clip.scaleY ); //translate the movieclip to its zero point if (transformer.matrix.tx == 0 && transformer.matrix.ty == 0) transformer.translateToZero( bounds );

//draw the bitmap data with the transformers bitmapData.draw( this._source, transformer.matrix, transformer.colorTransform, transformer.blendMode, transformer.clipRect, //new Rectangle(0, 0, bounds.width, bounds.height), transformer.smoothing );

//push the data on the array frames.push( bitmapData ); }

Now the result is different - http://i42.tinypic.com/lfv52.jpg - (note the head and left shoe). Anyone knows what the problem is? I've seen people adding 'extra' pixels to their boundary box at the BitmapData constructor, but thats nasty imo.

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about bitmapdata